package com.obas.integration.element.telnet.editor;

import com.obas.integration.element.telnet.type.ZTEMacAddressType;
import com.obas.model.business.DeviceMacAddress;

public class ZTEC300TelnetEditor extends AbstractTelnetEditor {

	public DeviceMacAddress editAsText(String text) {

		String macAddress = formatString(text.substring(0, 18));
		String vlanId = formatString(text.substring(18, 26));
		String type = formatString(text.substring(26, 37));
		String port = formatString(text.substring(37, 63));
		String vc = formatString(text.substring(63, 73));
		String time = formatString(text.substring(73, 79));

		DeviceMacAddress deviceMacAddress = new DeviceMacAddress();

		// HWPortFeatureType hWPortFeatureType = HWPortFeatureType.getByText(substring(port,0,2));
		// deviceMacAddress.setPortFeatureType(null != hWPortFeatureType ? hWPortFeatureType.getPortFeatureType() :
		// null);

		deviceMacAddress.setMacAddress(asMacAddress(macAddress));

		ZTEMacAddressType zTEMacAddressType = ZTEMacAddressType.getByText(type);
		deviceMacAddress.setMacAddressType(null != zTEMacAddressType ? zTEMacAddressType.getMacAddressType() : null);

		deviceMacAddress.setPortCode(port);
		deviceMacAddress.setVlan(vlanId);

		return deviceMacAddress;
	}

}
